


import com.alibaba.fastjson.JSON;

public class Message {
    public String action;
    public String carid;
    public String destination; //x y

    Message(String action,String carid, String destination)
    {
        this.action=action;
        this.carid=carid;
        this.destination=destination;
    }
    // 序列化为 JSON 字符串
    public String toJson() {
        return JSON.toJSONString(this);
    }

    // 从 JSON 字符串反序列化
    public static Message fromJson(String json) {
        return JSON.parseObject(json, Message.class);
    }
}

